const isEmpty = (value) => {
    if (typeof (value) == 'undefined' || null == value) {
        return true;
    } else {
        return false;
    }
}
const queryString = {
    get: () => {
        let result = location.search.match(new RegExp("[\?\&][^\?\&]+=[^\?\&]+", "g"));
        if (result == null) return "";
        for (let i = 0; i < result.length; i++) {
            result[i] = result[i].substring(1);
        }
        return result;
    },
    getByName: (name) => {
        let result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));
        if (result == null || result.length < 1) return "";
        return result[1];
    },
    getByIndex: () => {
        if (index == null) return "";
        let queryStringList = getQueryString();
        if (index >= queryStringList.length) return "";
        let result = queryStringList[index];
        let startIndex = result.indexOf("=") + 1;
        result = result.substring(startIndex);
        return result;
    }
}
const isInt = (value) => {
    return (/^[1-9]+[0-9]*]*$/).test(value);
}
const isEmail = (value) => {
    return (/^\w+@([0-9a-zA-Z]+[.])+[a-z]{2,4}$/).test(value);
}
const getCookie = (name) => {
    let arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
    if (arr = document.cookie.match(reg)) return unescape(arr[2]);
    else return null;
}
const setCookie = (name, value, hour) => {
    hour = isEmpty(hour) ? 24 : hour;
    let now = new Date();
    now = now.getTime() + (now.getTimezoneOffset() * 60000) + (3600000 * 8); //8灏忔椂鏃堕棿宸� 鍜屾椂鍖哄樊
    now = new Date(now);
    now.setTime(now.getTime() + hour * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ((hour == null) ? "" : ";expires=" + now.toGMTString())
}
const addCollection = (url, title) => {
    const b = navigator.userAgent.toLowerCase();
    if (b.indexOf("360se") > -1) {
        alert("鐢变簬360娴忚鍣ㄥ姛鑳介檺鍒讹紝璇锋寜 Ctrl+D 鎵嬪姩鏀惰棌锛�");
    } else if (b.indexOf("msie 8") > -1) {
        window.external.AddToFavoritesBar(url, title); //IE8
    } else if (document.all) { //IE绫绘祻瑙堝櫒
        try {
            window.external.addFavorite(url, title);
        } catch (e) {
            alert('鎮ㄧ殑娴忚鍣ㄤ笉鏀寔,璇锋寜 Ctrl+D 鎵嬪姩鏀惰棌!');
        }
    } else if (window.sidebar) { //firfox绛夋祻瑙堝櫒锛�
        window.sidebar.addPanel(title, url, "");
    } else {
        alert('鎮ㄧ殑娴忚鍣ㄤ笉鏀寔,璇锋寜 Ctrl+D 鎵嬪姩鏀惰棌!');
    }
}
const checkedAll = (selectAll, selects) => {

}
const backTop = (btn, height) => {
    btn.style.display = "none";
    window.onscroll = function () {
        let t = document.documentElement.scrollTop || document.body.scrollTop; //鑾峰彇璺濈椤甸潰椤堕儴鐨勮窛绂�
        if (t >= height) {
            btn.style.display = "block";
        } else {
            btn.style.display = "none";
        }
    }
    btn.onclick = function () {
        document.body.scrollTop = 0;
        document.documentElement.scrollTop = 0;
    }
}
const fullscreen = (ele) => {
    if (ele.requestFullscreen) {
        ele.requestFullscreen();
    } else if (ele.mozRequestFullScreen) {
        ele.mozRequestFullScreen();
    } else if (ele.webkitRequestFullscreen) {
        ele.webkitRequestFullscreen();
    } else if (ele.msRequestFullscreen) {
        ele.msRequestFullscreen();
    }
}
console.log(isEmail("497539758.com"));